package cn.east196.xfx.controls;


import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;

import java.util.Map;

import cn.east196.xfx.TreeLeaf;


public class SimpleTreeItem extends HBox {


  private String labelText;
  private Map data;
  private TreeLeaf message;


  public SimpleTreeItem(String labelText) {
    super();
    this.labelText = labelText;
    Label label = new Label(labelText);
    getChildren().add(label);
  }

  public SimpleTreeItem(String labelText, String imagePath) {
    super();
    this.labelText = labelText;
    Label label = new Label(labelText);
    ImageView imageView = new ImageView(imagePath);
    getChildren().add(imageView);
    getChildren().add(label);
    this.setMargin(label, new Insets(0, 0, 0, 1));
    this.setAlignment(Pos.CENTER_LEFT);
  }

  public String getLabelText() {
    return labelText;
  }

  public void setLabelText(String labelText) {
    this.labelText = labelText;
  }

  public Map getData() {
    return data;
  }

  public void setData(Map data) {
    this.data = data;
  }

  public TreeLeaf getMessage() {
    return message;
  }

  public void setMessage(TreeLeaf message) {
    this.message = message;
  }
}
